#coding = utf-8
import requests
import  os
import time
import re
from bs4 import BeautifulSoup

headers = {
    'Referer': 'http://www.meizitu.com/',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36',
    'Upgrade-Insecure-Requests': '1',
}

url_first = 'http://www.meizitu.com'
req_first = requests.get(url_first,headers = headers)
req_first.encoding = req_first.apparent_encoding
soup_first = BeautifulSoup(req_first.text,'html.parser')
tags = soup_first.find('div',class_='tags')
urls_first_list = []
for link in tags.find_all('a'):
    urls_first_list.append(link.get('href'))
for url in urls_first_list:
    req_second = requests.get(url,headers = headers)
    req_second.encoding = req_second.apparent_encoding
    soup_second = BeautifulSoup(req_second.text,'html.parser')
    # inWrap = soup_second.find('div',class_='inWrap')
    # urls_second_list = ['url']
    # print(wp_page_numbers)
    # for link in wp_page_numbers.find_all('a'):
    #     urls_second_list.append('http://www.meizitu.com/a/'+link.get('href'))
